package fusion;

//import JavaReedInterface;

import java.io.Serializable;





public class FusionAdd implements Serializable{
	int numStructures;
	int maxFaults;
	int galoisW;

	public FusionAdd(int numStructures, int maxFaults){
		this.numStructures = numStructures;
		this.maxFaults = maxFaults;
		galoisW = 16;
	}
	
	public int[] getRecoveredData(int[] codeWords,int[] dataWords,int[] erasures) throws InterfaceException{
        int errIdx = 0;
        for(int i = 0; i < erasures.length; ++i) {
            if(erasures[i] != -1) {
                errIdx = erasures[i];
                break;
            }
        }
        int[] ret = new int[numStructures];
        for(int i = 0; i < dataWords.length; i++) {
            if(i != errIdx) {
                codeWords[0] -= dataWords[i];
                ret[i] = dataWords[i];
            }
        }
        ret[errIdx] = codeWords[0];
        return ret;
    }
	


	public int getUpdatedCode(int code,int codeIndex, int oldValue,int newValue,int sourceId) throws InterfaceException{
        return code - oldValue + newValue;
	}
	
	public static void main(String[] args) {
		System.out.println("trying to muck with fusion");
		//Fusion.initialize(1, 1);  
	}
	
}
